﻿#include <wx/wx.h>
#include <wx/artprov.h>
#include <wx/wxprec.h>
#include "../json/json.h"
#include "ChatFrame.h"
#include <wx/dcbuffer.h>

class DiagFrame : public wxFrame
{
public:
    DiagFrame(const wxString& title);
    void OnMouse(wxMouseEvent& mouseEvent);
    void New(wxCommandEvent& event);
    void OnMouseWheel(wxMouseEvent& mouseEvent);
    void InCon(wxCommandEvent& event);
    void OnSave(wxCommandEvent& event);
    void OnImportComponentFile(wxCommandEvent& event);
    void OnPaint(wxPaintEvent& event);
    void JsonAdd(wxPoint startP, wxPoint endP);

    void Clear(wxCommandEvent& event);
    void PopBack(wxCommandEvent& event);
    void Select(wxCommandEvent& event);
    void _search(wxPoint pos);
    void Move(wxPoint pos);
    void Line(wxCommandEvent& event);
    void ChatPaint(wxCommandEvent& event);
    void CreateChatPanel();
    void ToggleChatPanel(wxCommandEvent& event);
    void OnTimer(wxTimerEvent& timeevent);
    void MouseMotion(wxMouseEvent& mouseevent);

    ChatPanel* m_chatPanel;
    wxPanel* panel;
    bool  nowable;     //是否可以绘制

    std::vector<Json::Value> draws;
    std::vector<Json::Value> draws1;//图形保存
    Json::Value* now;//选中的图形的地址
    wxPoint diagstartP, diagendP, centerP;
    wxString componentname;
    wxPanel* m_parent;
    Json::Value drawing;
    int flag = 0;
    wxString name1;
    wxString saveTimeStr;
    wxRect selectionBox;
    double zoomFactor = 1;
    std::vector<wxString> selectedItems;
    
    wxTimer* diagtimer;
    wxStaticText* st1;
    wxStaticText* st2;
    wxPoint Pos;


};


const int ID_DIAG_CLEAR = 99;
const int ID_DIAG_BACK = 100;
const int wxID_IMP = 101;
const int IDdiag = 102;
const int ID_DIAG_SELECT = 103;
const int wxID_DRAWLINE = 104;
const int ID_LINE2 = 105;
const int ID_CHAT1 = 106;
const int ID_CHAT2 = 107;

